using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI;

namespace ZhiAo.CommonLibrary
{
    public  class CookieHelper
    {

        public static string GetCookie(string key)
        {
            HttpCookie cookie = HttpContext.Current.Request.Cookies[key];
            if (cookie != null)
            {
                if (cookie[key] != null)
                {
                    return cookie[key].ToString();
                }
            }
            return "";
        }

        public static void SetCookie(string key, string value)
        {
            HttpCookie newcookie = new HttpCookie(key);
            newcookie.Values[key] = value;
            newcookie.Expires = DateTime.Now.AddYears(1);
           
            HttpContext.Current.Response.AppendCookie(newcookie);
        }
    }
}
